package ishacrm.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Hyperlink;
import com.google.gwt.user.client.ui.Widget;

public class MasterLayout extends Composite {

	private static MasterLayoutUiBinder uiBinder = GWT
			.create(MasterLayoutUiBinder.class);

	interface MasterLayoutUiBinder extends UiBinder<Widget, MasterLayout> {
	}

	public MasterLayout() {
		initWidget(uiBinder.createAndBindUi(this));
	}

	@UiField
	HTMLPanel contentHtmlPanel;	
	
	@UiField Hyperlink checkInNav;
	@UiField Hyperlink checkedInListNav;
		
	
	void setActiveNavLink(String token) {
		//active link will have bolded style
		
		//first remove bolded style from all links
		String style = "bolded";
		checkInNav.removeStyleName(style);
		checkedInListNav.removeStyleName(style);
		
		if (token == null)
			return;
		
		token = token.toLowerCase();
		if (token.contains("checkin"))
			checkInNav.addStyleName(style);
		
		if (token.contains("checkedinlist"))
			checkedInListNav.addStyleName(style);				
	}
}
